﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;
using vite_entity.Entities;

namespace vite_entity.EntityTypeConfig
{
    public class SysRoleMenu_TypeConfig : IEntityTypeConfiguration<SysRoleMenu>
    {
        public void Configure(EntityTypeBuilder<SysRoleMenu> entity)
        {
            entity
                .HasNoKey()
                .ToTable("sys_role_menu", tb => tb.HasComment("角色和菜单关联表"))
                .UseCollation("utf8mb4_general_ci");

            entity.HasIndex(e => new { e.RoleId, e.MenuId }, "uk_roleid_menuid").IsUnique();

            entity.Property(e => e.MenuId)
                .HasComment("菜单ID")
                .HasColumnName("menu_id");
            entity.Property(e => e.RoleId)
                .HasComment("角色ID")
                .HasColumnName("role_id");
        }
    }
}
